package com.gxuwz.service;

import com.gxuwz.mapper.ClassesMapper;
import com.gxuwz.model.entity.Classes;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class ClassesService {

    @Autowired
    private ClassesMapper classesMapper;

    // 根据 classID 查询班级
    public Classes getClassByClassID(String classID) {
        return classesMapper.selectClassByClassID(classID);
    }

    // 根据 className 查询班级
    public Classes getClassByClassName(String className) {
        return classesMapper.selectClassByClassName(className);
    }

    // 更新班级信息
    public boolean updateClass(Classes classes) {
        return classesMapper.updateClass(classes) > 0;
    }

    // 添加新的班级
    public boolean addClass(Classes classes) {
        return classesMapper.insertClass(classes) > 0;
    }

    // 根据 classID 删除班级
    public boolean deleteClassByClassID(String classID) {
        return classesMapper.deleteClassByClassID(classID) > 0;
    }

    // 查询所有二级学院
    public List<Classes> getAllClasses() {
        return classesMapper.getAllClass();
    }
}
